<?php include_once 'helper.php';
date_default_timezone_set('America/New_York');
authenticate();
include_once '../model/dao/GameDao.php';
include_once '../model/dao/TeamDao.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<?php
include '../view/header.php';
?>

	<div style="clear: both;"></div>
	<div class="mainbox">
		<p align="center">** Schedule **</p>

		<?php
		$month = ( isset($_POST['month2']) ? 10 : 9 );

		$gd = new GameDao();
		$td = new TeamDao();
		$schedule_slot = $gd->lookupByMonth($month);
		for( $ix = 0; $ix < 31; ++$ix ) {
			if( $schedule_slot[$ix] == 0 ) {
				continue;
			}
		$t1 = $td->lookupTeamName( $schedule_slot[$ix]->getTeam1Id() );
		$t2 = $td->lookupTeamName( $schedule_slot[$ix]->getTeam2Id() );
		if( $t1 == '0' ) $t1 = "Warriors";
		if( $t2 == '0' ) $t2 = "Warriors";
		$schedule_slot[$ix]->setTeam1Id( $t1 );
		$schedule_slot[$ix]->setTeam2Id( $t2 );
}
		include '../view/schedule.php';
		?>

	</div>
</body>
</body>
</html>
